<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2025/8/15 星期五
  Time: 10:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <base href="${pageContext.request.contextPath}/" />
    <title>襄阳蓝芯智能化办公系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="static/bootstrap-3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="static/bootstrapvalidator/css/bootstrapValidator.css"
          rel="stylesheet">
    <style>
        /*定义类名为.thead-blue的样式*/
        .thead-blue {
            color: #fff;
            font-weight: bold;
            background-color: #337ab7;
        }
    </style>
    <script src="static/jquery/jquery-1.10.2.min.js"></script>
    <script src="static/bootstrap-3.3.5/js/bootstrap.js"></script>
    <script src="static/bootstrapvalidator/js/bootstrapValidator.js"></script>

</head>
<body>

<!-- 搜索 -->
<div class="panel panel-primary">
    <div class="panel-heading">
        <h4 class="panel-title">单据详情</h4>
    </div>
    <div class="panel-body">
        <div class="col-md-10 col-md-offset-1" style="text-align: center">
            <h4><span class="label label-primary">${myApproval.proposerName}</span>
                的<c:forEach items="${docTypes}" var="docType">
                ${myApproval.docType eq docType.docType ? docType.docTypeName:""}
                </c:forEach>
                <button type="button" class="btn btn-success" onclick="location.href='${pageContext.request.contextPath}/zc-assetpurchaseapplydetails/towhereinfo?oid=${oid}&doctype=${myApproval.docType}'">查看申请单详情</button>
                <button type="button" class="btn btn-info"  data-toggle="modal" data-target="#docInfoModal">查看审批记录</button>
            </h4>
        </div>
    </div>
</div>

<div class="panel panel-primary">
    <div class="panel-heading">
        <h4 class="panel-title">单据审批</h4>
    </div>
    <div class="panel-body">
        <form action="judge/approval/doApproval" method="post" class="form-horizontal"
              role="form" id="approvalForm">
            <div class="modal-body">
                <div class="row">
                    <div class="form-group col-md-12">
                        <label for="status" class="col-md-3 control-label">审批状态</label>
                        <div class="col-md-8">
                            <input type="hidden" name="oid" id="oid" value="${oid}">
                            <select id="status" name="status" class="form-control">
                                <option value="">--请选择--</option>
                                <option value="Y">同意</option>
                                <option value="N">不同意</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-12">
                        <label for="opinion" class="col-md-3 control-label">审批意见</label>
                        <div id="docType" class="col-md-8">
								<textarea class="form-control" id="opinion" name="opinion" rows="5"
                                          placeholder="请输入审批意见"></textarea>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-12">
                        <div class="col-md-8  col-md-offset-3">
                            <button type="button" onclick="history.back()" class="btn btn-default">返回</button>
                            <button type="submit" id="sub" class="btn btn-primary">确认提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>


<%--审批记录--%>
<div class="modal fade" id="docInfoModal" tabindex="-1" role="dialog"
     aria-labelledby="docInfoModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="docInfoModalLabel">申请单审批记录</h4>
            </div>
            <div class="modal-body">
                <c:forEach items="${approvalVos}" var="approvalVo" varStatus="loop">
                    <div class="row">
                        <div class="form-group col-md-12">
                            <div class="col-md-12">
                                <div class="panel panel-primary">
                                    <div class="panel-heading" style="text-align: center">
                                        ${approvalVo.nodeName}
                                    </div>
                                    <div class="panel-body">
                                        <div class="col-md-7">
                                            <span class="text-primary">${approvalVo.deptName}${approvalVo.jobName}</span>
                                            <span class="text-danger"></span> 审批
                                        </div>
                                        <div class="col-md-5">
                                            <span class="text-success"></span>
                                            <span class="text-danger"></span>
                                            <span class="text-warning">
                                            <c:choose>
                                                <c:when test="${approvalVo.status=='O'}">待审批</c:when>
                                                <c:when test="${approvalVo.status=='Y'}">审批通过</c:when>
                                                <c:when test="${approvalVo.status=='N'}">审批失败</c:when>
                                            </c:choose>
                                            </span>
                                        </div>
                                        <div class="col-md-12">
                                            &nbsp;
                                        </div>
                                        <div class="col-md-12">
                                            审批意见:${approvalVo.opinion}
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <c:if test="${loop.index+1<approvalVos.size()}">
                                <div class="col-md-6 col-md-offset-3" style="text-align: center">
                                    <img src="static/img/next.png" width="38px">
                                    <BR><BR>
                                </div>
                            </c:if>
                        </div>
                    </div>
                </c:forEach>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<br>
<br>
<br>



<!-- 模态框（Modal） -->
<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="confirmModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="confirmModalLabel">
                    提示
                </h4>
            </div>
            <div class="modal-body">
                确认删除吗？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
                <button type="button" id="subconfirm" class="btn btn-primary">
                    提交更改
                </button>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function(){
        $("#subconfirm").click(function(){
            deleteConfirm();
            $('#confirmModal').modal('hide');
        });
    });
</script>


<!-- 模态框（Modal） -->
<div class="modal fade" id="alertMsgModal" tabindex="-1" role="dialog" aria-labelledby="alertMsgModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="alertMsgModalLabel">
                    提示
                </h4>
            </div>
            <div class="modal-body" id="alertmsg">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>






<script type="text/javascript">
    $(document).ajaxError(function(event,xhr) {
        if(xhr.status=="403"){//没有权限
            document.location.href = xhr.getResponseHeader("url");
        }else if(xhr.status!="200"){
            //alert("服务器错误!");
            console.log("服务器错误!");
        }
    });
</script>


</body>
<script type="text/javascript">
    $(document).ready(function() {
        $("#approvalForm").bootstrapValidator({
            message : 'This value is not valid',
            feedbackIcons : {/*input状态样式图片*/
                valid : 'glyphicon glyphicon-ok',
                invalid : 'glyphicon glyphicon-remove',
                validating : 'glyphicon glyphicon-refresh'
            },
            fields : {
                status : {
                    validators : {
                        notEmpty : {/*非空提示*/
                            message : '请选择审批状态'
                        }
                    }
                },
                opinion : {
                    validators : {
                        notEmpty : {/*非空提示*/
                            message : '请填写审批意见'
                        }
                    }
                }
            },
            submitHandler : function(validator,form, submitButton) {
                validator.defaultSubmit();
            }
        });
    });
</script>
</html>